import React, { Component } from 'react';
import Index from './pages/index'
import {BrowserRouter as Router, Route} from 'react-router-dom'
import About from './pages/about'
import Inbox from './pages/inbox'
import PubSub from 'pubsub-js';
class App extends Component {
  constructor(){
    super();
    this.state = {
      myName:"1"
    }
  }
  componentWillMount(){
    let self = this;
    PubSub.subscribe('PubSubmessage',function(pubsubName,msg){
        self.setState({
          myName:msg
        });
    });

  }
  render() {
    return (
       <Router>
        <div>
           <Route path="/" exact component={Index}></Route>
           <Route path="/about" component={About}></Route>
           <Route path="/inbox" component={Inbox}></Route>
        </div>
      </Router>
    );
  }
}

export default App;
